package com.yy.studyspringboot.genericity;

import java.util.ArrayList;
import java.util.List;

public class TestController {

    /**
     * TODO 枚举用法展示：应该在方法的入参加上下限。而不是在map定义的时候加泛型上下限
     * @param args
     */
    public static void main(String[] args) {
//        HashMap<Integer, ? super BB > map = new HashMap<>();
//        map.put(1,new AA());
//        map.put(1,new BB());
//        map.put(1,new CC());
//        map.put(1,new User());


//        HashMap<Integer, ? extends BB > map4 = new HashMap<>();
//        map4.put(1,new AA());
//        map4.put(1,new BB());
//        map.put(1,new CC());

        TestController testController = new TestController();
        ArrayList<AA> AAlist = new ArrayList<>();
        AAlist.add(new AA());
        ArrayList<BB> BBlist = new ArrayList<>();
        BBlist.add(new BB());
        ArrayList<CC> CClist = new ArrayList<>();
        CClist.add(new CC());

        testController.set1(AAlist);
        testController.set1(BBlist);
//        testController.set1(CClist);

//        testController.set2(AAlist);
        testController.set2(BBlist);
        testController.set2(CClist);
    }

    public void set1(List<? extends BB> list) {

    }
    public void set2(List<? super BB> list) {

    }


}
